# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select


from flask import Flask
from flask_cors import CORS

import time

driver = webdriver.Firefox()

app=Flask(__name__)
CORS(app)
@app.route("/")
def main():
    # return {"id":10,"pid":2,"uuid":5,"info":"v2.7.0-v3.7.0","lang":"中文"}

# for b in range(3):
	

	driver.get('https://e.xueyuankeji.cn/Lp_ThrowProDy?cid=7498&sid=419595&tid=9&cpyid=125&notAutoJump=1&forceH5=1&nfl=1&rstPage=toMobile&mid=4595&theme=11&dev=1dd3ceb0766&appname=bjxykjfwh&spm=s419595c7498t9m4595te11cp125&salt=cef19686&wx_aid=45723226008&gdt_vid=wx035lyjgtfzh6su01&wx_traceid=wx035lyjgtfzh6su01&weixinadinfo=45723226008.wx035lyjgtfzh6su01.0.0&traceid=wx035lyjgtfzh6su01&aid=45723226008&uxinfo=45723226008%7Cwx035lyjgtfzh6su01%7C45723226008%7C0%7C1751719888%7C0%7C2%7C6003761440339287%7C%7CAgKXl9owOfslZPoQemothcWS4CZt2LuBMi6QsyAlC7bmVCgv5Ezhof4SKvUPGYLg0Is%3D%7C47037856547%7C21%7C0%7CoDdoCt9lnyVEqMktPWi80w7fpjmQ%7C3%7C3606224291')
	# if b==0:
	# 	time.sleep(30)
	# else:
		#
	time.sleep(5)


	a=2
	for x in range(3):
		time.sleep(3)
		strs=".list .item.df:nth-of-type("+str(a)+") .box .van-radio-group .van-radio.radio:nth-of-type(1)"

		jy=driver.find_element(By.CSS_SELECTOR, strs)
		jy.click()
		a=a+2

	time.sleep(3)
	jy=driver.find_element(By.CSS_SELECTOR, ".questionView .submit")
	jy.click()

	time.sleep(10)

	gurl=driver.current_url
	f=""
	fs=""
	f=open('FILE.TXT',"a+")
	fs=f.read()
	f.write(fs+"\n"+gurl)
	array=gurl.split("?customer_channel=")
	return {"url":array[0],"option":array[1]}

if __name__ == '__main__':
	app.run(host="127.0.0.1",port=8091,debug=True)








